$(window).on('resize', function() {
    var $content = $('.content');
    $content.height($(this).height() - 120);
    $content.find('iframe').each(function() {
        $(this).height($content.height());
    });
}).resize();

var vm = new Vue({
    el: '#rrapp',
    data: {
        main: "main.html",
        navTitle: "首页",
        isAdmin: false
    },
    methods: {}
});

// 初始化路由
function initializeRouter() {
    var router = new Router();
    var menus = ["main.html", "geo/point.html","druid/index.html", "doc.html"];
    routerList(router, menus);
    router.start();
}

function routerList(router, menus) {
    for (let i = 0; i < menus.length; i++) {
        router.add('#' + menus[i], function() {
            var url = window.location.hash;
            vm.main = url.replace('#', '');
            $(".sidebar-menu li").removeClass("active"); // 修正 selector
            $("a[href='" + url + "']").parents("li").addClass("active");
            vm.navTitle = $("a[href='" + url + "']").text();
        });
    }
}

// 页面加载时检查登录状态
$(document).ready(function() {
    initializeRouter();
});
